<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="/public/stylesheets/reset.min.css" rel="stylesheet">
<link rel="stylesheet" href="/public/lib/css/xcConfirm.css">
<script src="/public/lib/js/jquery.js"></script>

<script src="/public/lib/js/ejs.js"></script>
<script src="/public/lib/js/require.js"></script>
<script src="/public/lib/js/xcConfirm.js"></script>
<script>
    require.config({
        baseUrl: '/',
        paths: {},
        waitSeconds: 0,
        map: {
            '*': {
                'text': 'public/lib/js/require-text',
                'css': 'public/lib/js/require-css'
            }
        }
    });

    Date.prototype.Format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }

    var _ajax = $.ajax;
    $.ajax = function (opt) {
        $("._loading").removeClass("hide");
        var success = opt.success || function () {};
        var complete = opt.complete || function () {};
        var error = opt.error || function () {};
        opt.success = function (res) {
            if(res.code == 200){
                success(res);
            }else{
                console.log(res);
                window.wxc.xcConfirm(res.msg || "服务器错误", window.wxc.xcConfirm.typeEnum.error);
            }
        }
        opt.error = function (res) {
            window.wxc.xcConfirm(res.msg || "服务器错误", window.wxc.xcConfirm.typeEnum.error);
        }
        opt.complete = function () {
            complete();
            $("._loading").addClass("hide");
        }
        _ajax(opt);
    }


    function getParams(url) {
        var obj = {};
        url  = url || "";
        url = url.split("?")[1];
        if(url){
            var ars = url.split("&");
            for(var i = 0; i < ars.length; i++){
                var a = ars[i].split("=");
                obj[a[0]] = a[1];
            }
        }
        return obj;
    }

</script>
<style>
    ._loading{
        position: fixed;
        bottom: 60px;
        right: 200px;
    }
</style>
<div class="_loading hide">
    <img src="/public/img/loading.gif" alt="">
</div>